package mvc.controller;

import mvc.model.service.ProductService;
import mvc.model.service.impl.ProductServiceImpl;
import mvc.model.vo.ProListBean;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

@WebServlet(name = "ProListServlet",urlPatterns = "/prolist")
public class ProListServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String index = req.getParameter("index");
        ProductService productService = new ProductServiceImpl();
        List<ProListBean> proList = new ArrayList<>();
        proList = productService.queryProList(index);
        req.getSession().setAttribute("proList",proList);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

    }
}
